<template>
  <div class="table_content">
    <!-- <Scerh></Scerh> -->
    <el-form class="table_serch">
      <div class="table_serch_labe" style="margin-left: 0px">
        <div class="table_serch_labe_title">机种</div>
           <Ariplandown :modlulist="modlulist"  :formInline="formInline" ></Ariplandown>
       </div>

      <div class="table_serch_labe" style="margin-left: 0px">
        <div class="table_serch_labe_title">线体</div>
          <Linedrpdown @change='onchange' :linedroplist="linedroplist" :formInline="formInline"></Linedrpdown>
      </div>

      <div class="table_serch_labe" style="margin-left: 0px">
        <div class="table_serch_labe_title">设备</div>
             <el-select
                  v-model="formInline.site"
                  clearable
                  size="mini"
                  style="margin-left: 5px; margin-top: 8px; width: 140px"
                  placeholder="请选择内容"
                >
                  <el-option v-for="(item,index) in this.siteItems" :key="index"
                    :label="item"
                    :value="item"
                  >

                  </el-option>
                </el-select>
      </div>

      <div class="table_serch_labe" style="margin-left: 0px">
        <div class="table_serch_labe_title">班次</div>
        <el-form-item label="">
           <el-select
               v-model="formInline.class"
               clearable
               size="mini"
               style="margin-left: 5px; margin-top: 0px; width: 140px"
               placeholder="请选择内容"
                >
                <el-option label="白班"  value="白班"></el-option>
                <el-option label="夜班"  value="夜班"></el-option>
              </el-select>
        </el-form-item>
      </div>

      <div class="table_serch_labe" style="margin-left: 0px">
        <div class="table_serch_labe_title">缺陷类型</div>
           <el-form-item label="">
                  <Defectoptions
                  :Defectlist="Defectlist"
                  :formInline="formInline"
                  ></Defectoptions>
            </el-form-item>
      </div>

      <div class="table_serch_labe">
        <div class="table_serch_labe_title" style="margin-left: 0px">
          选择日期
        </div>
        <el-form-item label="">
          <Endtiem :formInline="formInline"></Endtiem>
          <!-- <el-date-picker
            size="mini"
            v-model="formInline.endtime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择日期"
            style="width: 135px; margin-left: 5px"
          >
          </el-date-picker> -->
        </el-form-item>
      </div>

      <div class="table_serch_labe" style="margin-left: 0%">
        <el-button
          type="primary"
          size="mini"
          @click="formInlineclick"
          style="height: 30px; margin-top: 4px"
          >查询</el-button
        >
        <!-- <el-button type="mini">运行</el-button>  -->
      </div>
    </el-form>

    <div class="table_chart">
      <div class="my_table">
        <el-tabs v-model="activeName"  @tab-click="handleClick">
          <el-tab-pane label="总缺陷个数统计(个数)" name="second" style="width:100%">
            <!-- 第yi个柱状图 -->
            <div id="my_second"></div>
            <!-- <div style="margin-top:-10px; font-size: 14px">缺陷个数量统计</div> -->
            <div  id="el-table-list">
                <el-table
                  id="el-table-list"
                  :data="Countlist.slice(1)"
                  size="mini"
                  border
                  highlight-current-row
                  :cell-style="rowClass"
                  :header-cell-style="headClass"
                  @row-click="hanclick"
                  :row-style="{ height: '10px' }"
                  style="width:100%;font-size:8px;margin-left:0px;margin-top:-10px"
                >
                  <el-table-column
                    min-width=10
                    class="el_table_cloum"
                    v-for="(item, index) in this.defectNum[0]"
                    :key="index"
                    :label="item"
                    :prop="item"
                  >
                  </el-table-column>
                </el-table>
            </div>
          </el-tab-pane>
          <el-tab-pane label="缺陷占总产量百分比统计(%)" name="first" >
            <!-- 柱状图 -->
             <div>
                <div id="myChart"></div>
                  <div id="el-table-list">
                      <el-table
                      id="el-table-list"
                        :data="Yieidlist.slice(1)"
                        border
                        highlight-current-row
                        size="mini"
                        @row-click="hanclick"
                        :cell-style="rowClass"
                        :header-cell-style="headClass"
                        :row-style="{ height: '10px' }"
                        style="font-size:10px;margin-left:0px;margin-top:-10px"
                      >
                        <el-table-column
                        min-width=10
                          v-for="(item, index) in this.inYield[0]"
                          :key="index"
                          :label="item"
                          :prop="item"
                        >
                        </el-table-column>
                      </el-table>
                  </div>
             </div>  
          </el-tab-pane>
          <el-tab-pane label="缺陷分布趋势(%)" name="third" style="width:100%">
            <!-- 第三个柱状图 -->
            <div id="mythreebar"></div>
              <div id="el-table-list">
                  <el-table
                    :data="NGlist.slice(1)"
                    border
                    size="mini"
                    :cell-style="rowClass"
                    :header-cell-style="headClass"
                    @row-click="hanclick"
                    highlight-current-row
                    :row-style="{ height: '10px' }"
                    style="font-size: 10px;margin-left:0px;margin-top:-10px"
                  >
                    <el-table-column
                      min-width=10
                      v-for="(item, index) in this.inNg[0]"
                      :key="index"
                      :label="item"
                      :prop="item"
                    >
                    </el-table-column>
                  </el-table>
              </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>

    <!-- <div class="table_loding" v-show="isshow">
      <div class="table_title">加载中... ....</div>
      <div class="table_timer">网络请求延时: {{ timer }}秒</div>
    </div> -->

    <Popup
      v-show="Popup_show"
      @ClosePopup="ClosePopup"
      @cancelget="cancelget"
      :timer="timer"
    ></Popup>
  </div>
</template>
<script>

import Endtiem from '../../../components/endTime/Endtime'
import Linedrpdown from '../../../components/Linedropdown/Linedropdown'
import Ariplandown from '../../../components/Airplandown/Airplandown'
import Defectoptions from '../../../components/Defectoptions/Defectoptions'
import axios from "axios";
import Popup from "../../Pop-up/Pop-up";
export default {
  components: {
    Popup,Ariplandown,Linedrpdown,Defectoptions,Endtiem
  },
  data() {
    return {
      Popup_show: false,
      timer: 0,
      isshow: false,
      cancel: null,
      valtimer: "",
      Popup_timer: "",
      formInline: {
        recipe: "",
        order: "",
        line: "",
        site: "",
        endtime: "",
        errorcode: "",
        class: "",
        personid: "",
        type: [],
      },
      restaurants: [],
      activeName: "second",
      list: [],
      barcount: [],
      barinNg: [],
      barYieid: [],
      inYield: [],
      defectNum: [],
      inNg: [],
      Yieidlist: [],
      Countlist: [],
      NGlist: [],
      xAis: [],
      modlulist:[],
       linedroplist:[],
      sitedrwn:[],
      siteItems:[],
      Defectlist:[]
   };
  },

  mounted() {
     this.getModelnolist()
    // this.restaurants = this.loadAll();
    // this.timerclick();
  },
  methods: {

      onchange(){
        this.siteItems=[]
          this.sitedrwn.forEach((ele)=>{
            if(ele.ID.includes(this.formInline.line)){
              this.siteItems.push(ele.ID)
            }
         })
      },

     //页面查询方法
    formInlineclick() {
      if (this.formInline.recipe == "") {
        this.$message({
                showClose: true,
                message: "机种不能为空",
                type: "warning",
              });
      } else if (this.formInline.endtime == "") {
         this.$message({
                showClose: true,
                message: "日期不能为空",
                type: "warning",
              });
      } else {
        const CancelToken = axios.CancelToken;
        this.ajax({
          url: `prod/1000?endtime=${this.formInline.endtime}&recipe=${this.formInline.recipe}&line=${this.formInline.line}&site=${this.formInline.site}&class=${this.formInline.class}&order=${this.formInline.order}&personid=${this.formInline.personid}&errorcode=${this.formInline.errorcode}`,
          method: "GET",
          cancelToken: new CancelToken((c) => {
            this.cancel = c;
          }),
        }).then((res) => {
          var rulst = res.data;
          console.log(rulst)
          if (rulst) {
            this.inYield = rulst.tabledata.defInYield;
            this.defectNum = rulst.tabledata.defCount;
            this.inNg = rulst.tabledata.defInNg;

            this.barYieid = rulst.bardata.defInYield;
            this.barcount = rulst.bardata.defCount;
            this.barinNg = rulst.bardata.defInNg;
            this.xAis = rulst.xAis;
               if (this.barcount.length) {
                  this.myhistogram();
                  this.Tabudataparsingokdata();
                }else{
                    this.$message({
                        showClose: true,
                        message: '数据返回为空，请重新重新请求',
                        type: 'error'
                      });
                    setTimeout(()=>{
                         this.$router.go(0);
                      },300)
                }



            if (this.inYield) {
               for(let i=1;i<this.inYield.length;i++){
                for(let j=1; j<this.inYield[i].length;j++){
                    this.inYield[i][j].toFixed(2)
                }
            }
              this.Tabudataparsing();
              this.getlist();
              
            }
           
            if (this.inNg) {
              this.Tabudatapaactivation();
              this.theerbra();
            }
          }
        });
      }
    },
 
   getModelnolist(){
        this.ajax(`func/1023/selProductList`).then((res)=>{
          if(res.status == 200){
             this.modlulist = res.data.product;
             this.linedroplist = res.data.line;
             this.sitedrwn = res.data.eqp;
          }
        })
         this.ajax(`func/1023/selDef`).then((res)=>{
           if(res.status == 200){
                for(var k = 0; k < res.data.length; k++){
                    if(this.Defectlist.indexOf(res.data[k].DFT_TYPE) == -1){
                        this.Defectlist.push(res.data[k].DFT_TYPE)
                    }
                }
           }
        })
      },

      // 表头样式设置
      headClass () {
        return 'text-align: center;background:#696969;color:#fff'
      },
 

       // 表格样式设置
      rowClass () {
              return 'text-align: center;'
      },

      ////表格单元点击事件
      hanclick(row,column,event){
           console.log('11',row)
           console.log('22',column)
           console.log('33',event)
      },

    ClosePopup() {
      this.Popup_show = false;
      clearInterval(this.Popup_timer);
    },

    //缺陷百分比数据解析
    Tabudataparsing() {
      this.Yieidlist = [];
      var titlelist = this.inYield[0];
      // console.log("------------------------", titlelist);
      var a = titlelist[0];
      var b = titlelist[1];
      var c = titlelist[2];
      var d = titlelist[3];
      var e = titlelist[4];
      var f = titlelist[5];
      var g = titlelist[6];
      var h = titlelist[7];
      var io = titlelist[8];
      var j = titlelist[9];
      var k = titlelist[10];
      var L = titlelist[11];
      var m = titlelist[12];
      var n = titlelist[13];
      var o = titlelist[14];
      var p = titlelist[15];
      var q = titlelist[16];
      var r = titlelist[17];
      var s = titlelist[18];
      var t = titlelist[19];
      if (this.inYield[0].length == 2) {
        for (let i = 1; i < this.inYield.length; i++) {
          var objon = {};
          objon[a] = this.inYield[i][0];
          objon[b] = this.inYield[i][1];
          this.Yieidlist.push(objon);
        }
      } else if (this.inYield[0].length == 3) {
        for (let i = 1; i < this.inYield.length; i++) {
          var obj0 = {};
          obj0[a] = this.inYield[i][0];
          obj0[b] = this.inYield[i][1];
          obj0[c] = this.inYield[i][2];
          // obj[d] = this.bartable[i][3];
          this.Yieidlist.push(obj0);
        }
      } else if (this.inYield[0].length == 4) {
        for (let i = 1; i < this.inYield.length; i++) {
          var obj = {};
          obj[a] = this.inYield[i][0];
          obj[b] = this.inYield[i][1];
          obj[c] = this.inYield[i][2];
          obj[d] = this.inYield[i][3];
          this.Yieidlist.push(obj);
        }
      } else if (this.inYield[0].length == 5) {
        for (let i = 1; i < this.inYield.length; i++) {
          var obj1 = {};
          obj1[a] = this.inYield[i][0];
          obj1[b] = this.inYield[i][1];
          obj1[c] = this.inYield[i][2];
          obj1[d] = this.inYield[i][3];
          obj1[e] = this.inYield[i][4];
          this.Yieidlist.push(obj1);
        }
      } else if (this.inYield[0].length == 6) {
        for (let i = 1; i < this.inYield.length; i++) {
          var obj2 = {};
          obj2[a] = this.inYield[i][0];
          obj2[b] = this.inYield[i][1];
          obj2[c] = this.inYield[i][2];
          obj2[d] = this.inYield[i][3];
          obj2[e] = this.inYield[i][4];
          obj2[f] = this.inYield[i][5];
          this.Yieidlist.push(obj2);
        }
      } else if (this.inYield[0].length == 7) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj3 = {};
          obj3[a] = this.inYield[i][0];
          obj3[b] = this.inYield[i][1];
          obj3[c] = this.inYield[i][2];
          obj3[d] = this.inYield[i][3];
          obj3[e] = this.inYield[i][4];
          obj3[f] = this.inYield[i][5];
          obj3[g] = this.inYield[i][6];
          this.Yieidlist.push(obj3);
        }
      } else if (this.inYield[0].length == 8) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj4 = {};
          obj4[a] = this.inYield[i][0];
          obj4[b] = this.inYield[i][1];
          obj4[c] = this.inYield[i][2];
          obj4[d] = this.inYield[i][3];
          obj4[e] = this.inYield[i][4];
          obj4[f] = this.inYield[i][5];
          obj4[g] = this.inYield[i][6];
          obj4[h] = this.inYield[i][7];
          this.Yieidlist.push(obj4);
        }
      } else if (this.inYield[0].length == 9) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj5 = {};
          obj5[a] = this.inYield[i][0];
          obj5[b] = this.inYield[i][1];
          obj5[c] = this.inYield[i][2];
          obj5[d] = this.inYield[i][3];
          obj5[e] = this.inYield[i][4];
          obj5[f] = this.inYield[i][5];
          obj5[g] = this.inYield[i][6];
          obj5[h] = this.inYield[i][7];
          obj5[io] = this.inYield[i][8];
          this.Yieidlist.push(obj5);
        }
      } else if (this.inYield[0].length == 10) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj6 = {};
          obj6[a] = this.inYield[i][0];
          obj6[b] = this.inYield[i][1];
          obj6[c] = this.inYield[i][2];
          obj6[d] = this.inYield[i][3];
          obj6[e] = this.inYield[i][4];
          obj6[f] = this.inYield[i][5];
          obj6[g] = this.inYield[i][6];
          obj6[h] = this.inYield[i][7];
          obj6[io] = this.inYield[i][8];
          obj6[j] = this.inYield[i][9];
          this.Yieidlist.push(obj6);
        }
      } else if (this.inYield[0].length == 11) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj7 = {};
          obj7[a] = this.inYield[i][0];
          obj7[b] = this.inYield[i][1];
          obj7[c] = this.inYield[i][2];
          obj7[d] = this.inYield[i][3];
          obj7[e] = this.inYield[i][4];
          obj7[f] = this.inYield[i][5];
          obj7[g] = this.inYield[i][6];
          obj7[h] = this.inYield[i][7];
          obj7[io] = this.inYield[i][8];
          obj7[j] = this.inYield[i][9];
          obj7[k] = this.inYield[i][10];
          this.Yieidlist.push(obj7);
        }
      } else if (this.inYield[0].length == 12) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj8 = {};
          obj8[a] = this.inYield[i][0];
          obj8[b] = this.inYield[i][1];
          obj8[c] = this.inYield[i][2];
          obj8[d] = this.inYield[i][3];
          obj8[e] = this.inYield[i][4];
          obj8[f] = this.inYield[i][5];
          obj8[g] = this.inYield[i][6];
          obj8[h] = this.inYield[i][7];
          obj8[io] = this.inYield[i][8];
          obj8[j] = this.inYield[i][9];
          obj8[k] = this.inYield[i][10];
          obj8[L] = this.inYield[i][11];
          this.Yieidlist.push(obj8);
        }
      } else if (this.inYield[0].length == 13) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj9 = {};
          obj9[a] = this.inYield[i][0];
          obj9[b] = this.inYield[i][1];
          obj9[c] = this.inYield[i][2];
          obj9[d] = this.inYield[i][3];
          obj9[e] = this.inYield[i][4];
          obj9[f] = this.inYield[i][5];
          obj9[g] = this.inYield[i][6];
          obj9[h] = this.inYield[i][7];
          obj9[io] = this.inYield[i][8];
          obj9[j] = this.inYield[i][9];
          obj9[k] = this.inYield[i][10];
          obj9[L] = this.inYield[i][11];
          obj9[m] = this.inYield[i][12];
          this.Yieidlist.push(obj9);
        }
      } else if (this.inYield[0].length == 14) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj10 = {};
          obj10[a] = this.inYield[i][0];
          obj10[b] = this.inYield[i][1];
          obj10[c] = this.inYield[i][2];
          obj10[d] = this.inYield[i][3];
          obj10[e] = this.inYield[i][4];
          obj10[f] = this.inYield[i][5];
          obj10[g] = this.inYield[i][6];
          obj10[h] = this.inYield[i][7];
          obj10[io] = this.inYield[i][8];
          obj10[j] = this.inYield[i][9];
          obj10[k] = this.inYield[i][10];
          obj10[L] = this.inYield[i][11];
          obj10[m] = this.inYield[i][12];
          obj10[n] = this.inYield[i][13];
          this.Yieidlist.push(obj10);
        }
      } else if (this.inYield[0].length == 15) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj11 = {};
          obj11[a] = this.inYield[i][0];
          obj11[b] = this.inYield[i][1];
          obj11[c] = this.inYield[i][2];
          obj11[d] = this.inYield[i][3];
          obj11[e] = this.inYield[i][4];
          obj11[f] = this.inYield[i][5];
          obj11[g] = this.inYield[i][6];
          obj11[h] = this.inYield[i][7];
          obj11[io] = this.inYield[i][8];
          obj11[j] = this.inYield[i][9];
          obj11[k] = this.inYield[i][10];
          obj11[L] = this.inYield[i][11];
          obj11[m] = this.inYield[i][12];
          obj11[n] = this.inYield[i][13];
          obj11[o] = this.inYield[i][14];
          this.Yieidlist.push(obj11);
        }
      } else if (this.inYield[0].length == 16) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj12 = {};
          obj12[a] = this.inYield[i][0];
          obj12[b] = this.inYield[i][1];
          obj12[c] = this.inYield[i][2];
          obj12[d] = this.inYield[i][3];
          obj12[e] = this.inYield[i][4];
          obj12[f] = this.inYield[i][5];
          obj12[g] = this.inYield[i][6];
          obj12[h] = this.inYield[i][7];
          obj12[io] = this.inYield[i][8];
          obj12[j] = this.inYield[i][9];
          obj12[k] = this.inYield[i][10];
          obj12[L] = this.inYield[i][11];
          obj12[m] = this.inYield[i][12];
          obj12[n] = this.inYield[i][13];
          obj12[o] = this.inYield[i][14];
          obj12[p] = this.inYield[i][15];
          this.Yieidlist.push(obj12);
        }
      } else if (this.inYield[0].length == 17) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj13 = {};
          obj13[a] = this.inYield[i][0];
          obj13[b] = this.inYield[i][1];
          obj13[c] = this.inYield[i][2];
          obj13[d] = this.inYield[i][3];
          obj13[e] = this.inYield[i][4];
          obj13[f] = this.inYield[i][5];
          obj13[g] = this.inYield[i][6];
          obj13[h] = this.inYield[i][7];
          obj13[io] = this.inYield[i][8];
          obj13[j] = this.inYield[i][9];
          obj13[k] = this.inYield[i][10];
          obj13[L] = this.inYield[i][11];
          obj13[m] = this.inYield[i][12];
          obj13[n] = this.inYield[i][13];
          obj13[o] = this.inYield[i][14];
          obj13[p] = this.inYield[i][15];
          obj13[q] = this.inYield[i][16];
          this.Yieidlist.push(obj13);
        }
      } else if (this.inYield[0].length == 18) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj14 = {};
          obj14[a] = this.inYield[i][0];
          obj14[b] = this.inYield[i][1];
          obj14[c] = this.inYield[i][2];
          obj14[d] = this.inYield[i][3];
          obj14[e] = this.inYield[i][4];
          obj14[f] = this.inYield[i][5];
          obj14[g] = this.inYield[i][6];
          obj14[h] = this.inYield[i][7];
          obj14[io] = this.inYield[i][8];
          obj14[j] = this.inYield[i][9];
          obj14[k] = this.inYield[i][10];
          obj14[L] = this.inYield[i][11];
          obj14[m] = this.inYield[i][12];
          obj14[n] = this.inYield[i][13];
          obj14[o] = this.inYield[i][14];
          obj14[p] = this.inYield[i][15];
          obj14[q] = this.inYield[i][16];
          obj14[r] = this.inYield[i][17];
          this.Yieidlist.push(obj14);
          // console.log('===============',this.tablelist)
        }
      } else if (this.inYield[0].length == 19) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj15 = {};
          obj15[a] = this.inYield[i][0];
          obj15[b] = this.inYield[i][1];
          obj15[c] = this.inYield[i][2];
          obj15[d] = this.inYield[i][3];
          obj15[e] = this.inYield[i][4];
          obj15[f] = this.inYield[i][5];
          obj15[g] = this.inYield[i][6];
          obj15[h] = this.inYield[i][7];
          obj15[io] = this.inYield[i][8];
          obj15[j] = this.inYield[i][9];
          obj15[k] = this.inYield[i][10];
          obj15[L] = this.inYield[i][11];
          obj15[m] = this.inYield[i][12];
          obj15[n] = this.inYield[i][13];
          obj15[o] = this.inYield[i][14];
          obj15[p] = this.inYield[i][15];
          obj15[q] = this.inYield[i][16];
          obj15[r] = this.inYield[i][17];
          obj15[s] = this.inYield[i][18];
          this.Yieidlist.push(obj15);
        }
      } else if (this.inYield[0].length == 20) {
        for (let i = 0; i < this.inYield.length; i++) {
          var obj16 = {};
          obj16[a] = this.inYield[i][0];
          obj16[b] = this.inYield[i][1];
          obj16[c] = this.inYield[i][2];
          obj16[d] = this.inYield[i][3];
          obj16[e] = this.inYield[i][4];
          obj16[f] = this.inYield[i][5];
          obj16[g] = this.inYield[i][6];
          obj16[h] = this.inYield[i][7];
          obj16[io] = this.inYield[i][8];
          obj16[j] = this.inYield[i][9];
          obj16[k] = this.inYield[i][10];
          obj16[L] = this.inYield[i][11];
          obj16[m] = this.inYield[i][12];
          obj16[n] = this.inYield[i][13];
          obj16[o] = this.inYield[i][14];
          obj16[p] = this.inYield[i][15];
          obj16[q] = this.inYield[i][16];
          obj16[r] = this.inYield[i][17];
          obj16[s] = this.inYield[i][18];
          obj16[t] = this.inYield[i][19];
          this.Yieidlist.push(obj16);
        }
      }
    },
    
    //缺陷数量统计数据解析
    Tabudataparsingokdata() {
      this.Countlist = [];
      var titlelist = this.defectNum[0];
      // console.log("------------------------", titlelist);
      var a = titlelist[0];
      var b = titlelist[1];
      var c = titlelist[2];
      var d = titlelist[3];
      var e = titlelist[4];
      var f = titlelist[5];
      var g = titlelist[6];
      var h = titlelist[7];
      var io = titlelist[8];
      var j = titlelist[9];
      var k = titlelist[10];
      var L = titlelist[11];
      var m = titlelist[12];
      var n = titlelist[13];
      var o = titlelist[14];
      var p = titlelist[15];
      var q = titlelist[16];
      var r = titlelist[17];
      var s = titlelist[18];
      if (this.defectNum[0].length == 2) {
        for (let i = 1; i < this.defectNum.length; i++) {
          var objon = {};
          objon[a] = this.defectNum[i][0];
          objon[b] = this.defectNum[i][1];
          this.Countlist.push(objon);
        }
      } else if (this.defectNum[0].length == 3) {
        for (let i = 1; i < this.defectNum.length; i++) {
          var obj0 = {};
          obj0[a] = this.defectNum[i][0];
          obj0[b] = this.defectNum[i][1];
          obj0[c] = this.defectNum[i][2];
          // obj[d] = this.bartable[i][3];
          this.Countlist.push(obj0);
        }
      } else if (this.defectNum[0].length == 4) {
        for (let i = 1; i < this.defectNum.length; i++) {
          var obj = {};
          obj[a] = this.defectNum[i][0];
          obj[b] = this.defectNum[i][1];
          obj[c] = this.defectNum[i][2];
          obj[d] = this.defectNum[i][3];
          this.Countlist.push(obj);
        }
      } else if (this.defectNum[0].length == 5) {
        for (let i = 1; i < this.defectNum.length; i++) {
          var obj1 = {};
          obj1[a] = this.defectNum[i][0];
          obj1[b] = this.defectNum[i][1];
          obj1[c] = this.defectNum[i][2];
          obj1[d] = this.defectNum[i][3];
          obj1[e] = this.defectNum[i][4];
          this.Countlist.push(obj1);
        }
      } else if (this.defectNum[0].length == 6) {
        for (let i = 1; i < this.defectNum.length; i++) {
          var obj2 = {};
          obj2[a] = this.defectNum[i][0];
          obj2[b] = this.defectNum[i][1];
          obj2[c] = this.defectNum[i][2];
          obj2[d] = this.defectNum[i][3];
          obj2[e] = this.defectNum[i][4];
          obj2[f] = this.defectNum[i][5];
          this.Countlist.push(obj2);
        }
      } else if (this.defectNum[0].length == 7) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj3 = {};
          obj3[a] = this.defectNum[i][0];
          obj3[b] = this.defectNum[i][1];
          obj3[c] = this.defectNum[i][2];
          obj3[d] = this.defectNum[i][3];
          obj3[e] = this.defectNum[i][4];
          obj3[f] = this.defectNum[i][5];
          obj3[g] = this.defectNum[i][6];
          this.Countlist.push(obj3);
        }
      } else if (this.defectNum[0].length == 8) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj4 = {};
          obj4[a] = this.defectNum[i][0];
          obj4[b] = this.defectNum[i][1];
          obj4[c] = this.defectNum[i][2];
          obj4[d] = this.defectNum[i][3];
          obj4[e] = this.defectNum[i][4];
          obj4[f] = this.defectNum[i][5];
          obj4[g] = this.defectNum[i][6];
          obj4[h] = this.defectNum[i][7];
          this.Countlist.push(obj4);
        }
      } else if (this.defectNum[0].length == 9) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj5 = {};
          obj5[a] = this.defectNum[i][0];
          obj5[b] = this.defectNum[i][1];
          obj5[c] = this.defectNum[i][2];
          obj5[d] = this.defectNum[i][3];
          obj5[e] = this.defectNum[i][4];
          obj5[f] = this.defectNum[i][5];
          obj5[g] = this.defectNum[i][6];
          obj5[h] = this.defectNum[i][7];
          obj5[io] = this.defectNum[i][8];
          this.Countlist.push(obj5);
        }
      } else if (this.defectNum[0].length == 10) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj6 = {};
          obj6[a] = this.defectNum[i][0];
          obj6[b] = this.defectNum[i][1];
          obj6[c] = this.defectNum[i][2];
          obj6[d] = this.defectNum[i][3];
          obj6[e] = this.defectNum[i][4];
          obj6[f] = this.defectNum[i][5];
          obj6[g] = this.defectNum[i][6];
          obj6[h] = this.defectNum[i][7];
          obj6[io] = this.defectNum[i][8];
          obj6[j] = this.defectNum[i][9];
          this.Countlist.push(obj6);
        }
      } else if (this.defectNum[0].length == 11) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj7 = {};
          obj7[a] = this.defectNum[i][0];
          obj7[b] = this.defectNum[i][1];
          obj7[c] = this.defectNum[i][2];
          obj7[d] = this.defectNum[i][3];
          obj7[e] = this.defectNum[i][4];
          obj7[f] = this.defectNum[i][5];
          obj7[g] = this.defectNum[i][6];
          obj7[h] = this.defectNum[i][7];
          obj7[io] = this.defectNum[i][8];
          obj7[j] = this.defectNum[i][9];
          obj7[k] = this.defectNum[i][10];
          this.Countlist.push(obj7);
        }
      } else if (this.defectNum[0].length == 12) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj8 = {};
          obj8[a] = this.defectNum[i][0];
          obj8[b] = this.defectNum[i][1];
          obj8[c] = this.defectNum[i][2];
          obj8[d] = this.defectNum[i][3];
          obj8[e] = this.defectNum[i][4];
          obj8[f] = this.defectNum[i][5];
          obj8[g] = this.defectNum[i][6];
          obj8[h] = this.defectNum[i][7];
          obj8[io] = this.defectNum[i][8];
          obj8[j] = this.defectNum[i][9];
          obj8[k] = this.defectNum[i][10];
          obj8[L] = this.defectNum[i][11];
          this.Countlist.push(obj8);
        }
      } else if (this.defectNum[0].length == 13) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj9 = {};
          obj9[a] = this.defectNum[i][0];
          obj9[b] = this.defectNum[i][1];
          obj9[c] = this.defectNum[i][2];
          obj9[d] = this.defectNum[i][3];
          obj9[e] = this.defectNum[i][4];
          obj9[f] = this.defectNum[i][5];
          obj9[g] = this.defectNum[i][6];
          obj9[h] = this.defectNum[i][7];
          obj9[io] = this.defectNum[i][8];
          obj9[j] = this.defectNum[i][9];
          obj9[k] = this.defectNum[i][10];
          obj9[L] = this.defectNum[i][11];
          obj9[m] = this.defectNum[i][12];
          this.Countlist.push(obj9);
        }
      } else if (this.defectNum[0].length == 14) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj10 = {};
          obj10[a] = this.defectNum[i][0];
          obj10[b] = this.defectNum[i][1];
          obj10[c] = this.defectNum[i][2];
          obj10[d] = this.defectNum[i][3];
          obj10[e] = this.defectNum[i][4];
          obj10[f] = this.defectNum[i][5];
          obj10[g] = this.defectNum[i][6];
          obj10[h] = this.defectNum[i][7];
          obj10[io] = this.defectNum[i][8];
          obj10[j] = this.defectNum[i][9];
          obj10[k] = this.defectNum[i][10];
          obj10[L] = this.defectNum[i][11];
          obj10[m] = this.defectNum[i][12];
          obj10[n] = this.defectNum[i][13];
          this.Countlist.push(obj10);
        }
      } else if (this.defectNum[0].length == 15) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj11 = {};
          obj11[a] = this.defectNum[i][0];
          obj11[b] = this.defectNum[i][1];
          obj11[c] = this.defectNum[i][2];
          obj11[d] = this.defectNum[i][3];
          obj11[e] = this.defectNum[i][4];
          obj11[f] = this.defectNum[i][5];
          obj11[g] = this.defectNum[i][6];
          obj11[h] = this.defectNum[i][7];
          obj11[io] = this.defectNum[i][8];
          obj11[j] = this.defectNum[i][9];
          obj11[k] = this.defectNum[i][10];
          obj11[L] = this.defectNum[i][11];
          obj11[m] = this.defectNum[i][12];
          obj11[n] = this.defectNum[i][13];
          obj11[o] = this.defectNum[i][14];
          this.Countlist.push(obj11);
        }
      } else if (this.defectNum[0].length == 16) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj12 = {};
          obj12[a] = this.defectNum[i][0];
          obj12[b] = this.defectNum[i][1];
          obj12[c] = this.defectNum[i][2];
          obj12[d] = this.defectNum[i][3];
          obj12[e] = this.defectNum[i][4];
          obj12[f] = this.defectNum[i][5];
          obj12[g] = this.defectNum[i][6];
          obj12[h] = this.defectNum[i][7];
          obj12[io] = this.defectNum[i][8];
          obj12[j] = this.defectNum[i][9];
          obj12[k] = this.defectNum[i][10];
          obj12[L] = this.defectNum[i][11];
          obj12[m] = this.defectNum[i][12];
          obj12[n] = this.defectNum[i][13];
          obj12[o] = this.defectNum[i][14];
          obj12[p] = this.defectNum[i][15];
          this.Countlist.push(obj12);
        }
      } else if (this.defectNum[0].length == 17) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj13 = {};
          obj13[a] = this.defectNum[i][0];
          obj13[b] = this.defectNum[i][1];
          obj13[c] = this.defectNum[i][2];
          obj13[d] = this.defectNum[i][3];
          obj13[e] = this.defectNum[i][4];
          obj13[f] = this.defectNum[i][5];
          obj13[g] = this.defectNum[i][6];
          obj13[h] = this.defectNum[i][7];
          obj13[io] = this.defectNum[i][8];
          obj13[j] = this.defectNum[i][9];
          obj13[k] = this.defectNum[i][10];
          obj13[L] = this.defectNum[i][11];
          obj13[m] = this.defectNum[i][12];
          obj13[n] = this.defectNum[i][13];
          obj13[o] = this.defectNum[i][14];
          obj13[p] = this.defectNum[i][15];
          obj13[q] = this.defectNum[i][16];
          this.Countlist.push(obj13);
        }
      } else if (this.defectNum[0].length == 18) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj14 = {};
          obj14[a] = this.defectNum[i][0];
          obj14[b] = this.defectNum[i][1];
          obj14[c] = this.defectNum[i][2];
          obj14[d] = this.defectNum[i][3];
          obj14[e] = this.defectNum[i][4];
          obj14[f] = this.defectNum[i][5];
          obj14[g] = this.defectNum[i][6];
          obj14[h] = this.defectNum[i][7];
          obj14[io] = this.defectNum[i][8];
          obj14[j] = this.defectNum[i][9];
          obj14[k] = this.defectNum[i][10];
          obj14[L] = this.defectNum[i][11];
          obj14[m] = this.defectNum[i][12];
          obj14[n] = this.defectNum[i][13];
          obj14[o] = this.defectNum[i][14];
          obj14[p] = this.defectNum[i][15];
          obj14[q] = this.defectNum[i][16];
          obj14[r] = this.defectNum[i][17];
          this.Countlist.push(obj14);
          // console.log("===============", this.oklist);
        }
      } else if (this.defectNum[0].length == 19) {
        for (let i = 0; i < this.defectNum.length; i++) {
          var obj15 = {};
          obj15[a] = this.defectNum[i][0];
          obj15[b] = this.defectNum[i][1];
          obj15[c] = this.defectNum[i][2];
          obj15[d] = this.defectNum[i][3];
          obj15[e] = this.defectNum[i][4];
          obj15[f] = this.defectNum[i][5];
          obj15[g] = this.defectNum[i][6];
          obj15[h] = this.defectNum[i][7];
          obj15[io] = this.defectNum[i][8];
          obj15[j] = this.defectNum[i][9];
          obj15[k] = this.defectNum[i][10];
          obj15[L] = this.defectNum[i][11];
          obj15[m] = this.defectNum[i][12];
          obj15[n] = this.defectNum[i][13];
          obj15[o] = this.defectNum[i][14];
          obj15[p] = this.defectNum[i][15];
          obj15[q] = this.defectNum[i][16];
          obj15[r] = this.defectNum[i][17];
          obj15[s] = this.defectNum[i][18];
          this.Countlist.push(obj15);
        }
      }
    },

    //缺陷NG数量
    Tabudatapaactivation() {
      this.NGlist = [];
      var titlelist = this.inNg[0];
      // console.log("------------------------", titlelist);
      var a = titlelist[0];
      var b = titlelist[1];
      var c = titlelist[2];
      var d = titlelist[3];
      var e = titlelist[4];
      var f = titlelist[5];
      var g = titlelist[6];
      var h = titlelist[7];
      var io = titlelist[8];
      var j = titlelist[9];
      var k = titlelist[10];
      var L = titlelist[11];
      var m = titlelist[12];
      var n = titlelist[13];
      var o = titlelist[14];
      var p = titlelist[15];
      var q = titlelist[16];
      var r = titlelist[17];
      var s = titlelist[18];
      if (this.inNg[0].length == 2) {
        for (let i = 1; i < this.inNg.length; i++) {
          var objon = {};
          objon[a] = this.inNg[i][0];
          objon[b] = this.inNg[i][1];
          this.NGlist.push(objon);
        }
      } else if (this.inNg[0].length == 3) {
        for (let i = 1; i < this.inNg.length; i++) {
          var obj0 = {};
          obj0[a] = this.inNg[i][0];
          obj0[b] = this.inNg[i][1];
          obj0[c] = this.inNg[i][2];
          // obj[d] = this.bartable[i][3];
          this.NGlist.push(obj0);
        }
      } else if (this.inNg[0].length == 4) {
        for (let i = 1; i < this.inNg.length; i++) {
          var obj = {};
          obj[a] = this.inNg[i][0];
          obj[b] = this.inNg[i][1];
          obj[c] = this.inNg[i][2];
          obj[d] = this.inNg[i][3];
          this.NGlist.push(obj);
        }
      } else if (this.inNg[0].length == 5) {
        for (let i = 1; i < this.inNg.length; i++) {
          var obj1 = {};
          obj1[a] = this.inNg[i][0];
          obj1[b] = this.inNg[i][1];
          obj1[c] = this.inNg[i][2];
          obj1[d] = this.inNg[i][3];
          obj1[e] = this.inNg[i][4];
          this.NGlist.push(obj1);
        }
      } else if (this.inNg[0].length == 6) {
        for (let i = 1; i < this.inNg.length; i++) {
          var obj2 = {};
          obj2[a] = this.inNg[i][0];
          obj2[b] = this.inNg[i][1];
          obj2[c] = this.inNg[i][2];
          obj2[d] = this.inNg[i][3];
          obj2[e] = this.inNg[i][4];
          obj2[f] = this.inNg[i][5];
          this.NGlist.push(obj2);
        }
      } else if (this.inNg[0].length == 7) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj3 = {};
          obj3[a] = this.inNg[i][0];
          obj3[b] = this.inNg[i][1];
          obj3[c] = this.inNg[i][2];
          obj3[d] = this.inNg[i][3];
          obj3[e] = this.inNg[i][4];
          obj3[f] = this.inNg[i][5];
          obj3[g] = this.inNg[i][6];
          this.NGlist.push(obj3);
        }
      } else if (this.inNg[0].length == 8) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj4 = {};
          obj4[a] = this.inNg[i][0];
          obj4[b] = this.inNg[i][1];
          obj4[c] = this.inNg[i][2];
          obj4[d] = this.inNg[i][3];
          obj4[e] = this.inNg[i][4];
          obj4[f] = this.inNg[i][5];
          obj4[g] = this.inNg[i][6];
          obj4[h] = this.inNg[i][7];
          this.NGlist.push(obj4);
        }
      } else if (this.inNg[0].length == 9) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj5 = {};
          obj5[a] = this.inNg[i][0];
          obj5[b] = this.inNg[i][1];
          obj5[c] = this.inNg[i][2];
          obj5[d] = this.inNg[i][3];
          obj5[e] = this.inNg[i][4];
          obj5[f] = this.inNg[i][5];
          obj5[g] = this.inNg[i][6];
          obj5[h] = this.inNg[i][7];
          obj5[io] = this.inNg[i][8];
          this.NGlist.push(obj5);
        }
      } else if (this.inNg[0].length == 10) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj6 = {};
          obj6[a] = this.inNg[i][0];
          obj6[b] = this.inNg[i][1];
          obj6[c] = this.inNg[i][2];
          obj6[d] = this.inNg[i][3];
          obj6[e] = this.inNg[i][4];
          obj6[f] = this.inNg[i][5];
          obj6[g] = this.inNg[i][6];
          obj6[h] = this.inNg[i][7];
          obj6[io] = this.inNg[i][8];
          obj6[j] = this.inNg[i][9];
          this.NGlist.push(obj6);
        }
      } else if (this.inNg[0].length == 11) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj7 = {};
          obj7[a] = this.inNg[i][0];
          obj7[b] = this.inNg[i][1];
          obj7[c] = this.inNg[i][2];
          obj7[d] = this.inNg[i][3];
          obj7[e] = this.inNg[i][4];
          obj7[f] = this.inNg[i][5];
          obj7[g] = this.inNg[i][6];
          obj7[h] = this.inNg[i][7];
          obj7[io] = this.inNg[i][8];
          obj7[j] = this.inNg[i][9];
          obj7[k] = this.inNg[i][10];
          this.NGlist.push(obj7);
        }
      } else if (this.inNg[0].length == 12) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj8 = {};
          obj8[a] = this.inNg[i][0];
          obj8[b] = this.inNg[i][1];
          obj8[c] = this.inNg[i][2];
          obj8[d] = this.inNg[i][3];
          obj8[e] = this.inNg[i][4];
          obj8[f] = this.inNg[i][5];
          obj8[g] = this.inNg[i][6];
          obj8[h] = this.inNg[i][7];
          obj8[io] = this.inNg[i][8];
          obj8[j] = this.inNg[i][9];
          obj8[k] = this.inNg[i][10];
          obj8[L] = this.inNg[i][11];
          this.NGlist.push(obj8);
        }
      } else if (this.inNg[0].length == 13) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj9 = {};
          obj9[a] = this.inNg[i][0];
          obj9[b] = this.inNg[i][1];
          obj9[c] = this.inNg[i][2];
          obj9[d] = this.inNg[i][3];
          obj9[e] = this.inNg[i][4];
          obj9[f] = this.inNg[i][5];
          obj9[g] = this.inNg[i][6];
          obj9[h] = this.inNg[i][7];
          obj9[io] = this.inNg[i][8];
          obj9[j] = this.inNg[i][9];
          obj9[k] = this.inNg[i][10];
          obj9[L] = this.inNg[i][11];
          obj9[m] = this.inNg[i][12];
          this.NGlist.push(obj9);
        }
      } else if (this.inNg[0].length == 14) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj10 = {};
          obj10[a] = this.inNg[i][0];
          obj10[b] = this.inNg[i][1];
          obj10[c] = this.inNg[i][2];
          obj10[d] = this.inNg[i][3];
          obj10[e] = this.inNg[i][4];
          obj10[f] = this.inNg[i][5];
          obj10[g] = this.inNg[i][6];
          obj10[h] = this.inNg[i][7];
          obj10[io] = this.inNg[i][8];
          obj10[j] = this.inNg[i][9];
          obj10[k] = this.inNg[i][10];
          obj10[L] = this.inNg[i][11];
          obj10[m] = this.inNg[i][12];
          obj10[n] = this.inNg[i][13];
          this.NGlist.push(obj10);
        }
      } else if (this.inNg[0].length == 15) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj11 = {};
          obj11[a] = this.inNg[i][0];
          obj11[b] = this.inNg[i][1];
          obj11[c] = this.inNg[i][2];
          obj11[d] = this.inNg[i][3];
          obj11[e] = this.inNg[i][4];
          obj11[f] = this.inNg[i][5];
          obj11[g] = this.inNg[i][6];
          obj11[h] = this.inNg[i][7];
          obj11[io] = this.inNg[i][8];
          obj11[j] = this.inNg[i][9];
          obj11[k] = this.inNg[i][10];
          obj11[L] = this.inNg[i][11];
          obj11[m] = this.inNg[i][12];
          obj11[n] = this.inNg[i][13];
          obj11[o] = this.inNg[i][14];
          this.NGlist.push(obj11);
        }
      } else if (this.inNg[0].length == 16) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj12 = {};
          obj12[a] = this.inNg[i][0];
          obj12[b] = this.inNg[i][1];
          obj12[c] = this.inNg[i][2];
          obj12[d] = this.inNg[i][3];
          obj12[e] = this.inNg[i][4];
          obj12[f] = this.inNg[i][5];
          obj12[g] = this.inNg[i][6];
          obj12[h] = this.inNg[i][7];
          obj12[io] = this.inNg[i][8];
          obj12[j] = this.inNg[i][9];
          obj12[k] = this.inNg[i][10];
          obj12[L] = this.inNg[i][11];
          obj12[m] = this.inNg[i][12];
          obj12[n] = this.inNg[i][13];
          obj12[o] = this.inNg[i][14];
          obj12[p] = this.inNg[i][15];
          this.NGlist.push(obj12);
        }
      } else if (this.inNg[0].length == 17) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj13 = {};
          obj13[a] = this.inNg[i][0];
          obj13[b] = this.inNg[i][1];
          obj13[c] = this.inNg[i][2];
          obj13[d] = this.inNg[i][3];
          obj13[e] = this.inNg[i][4];
          obj13[f] = this.inNg[i][5];
          obj13[g] = this.inNg[i][6];
          obj13[h] = this.inNg[i][7];
          obj13[io] = this.inNg[i][8];
          obj13[j] = this.inNg[i][9];
          obj13[k] = this.inNg[i][10];
          obj13[L] = this.inNg[i][11];
          obj13[m] = this.inNg[i][12];
          obj13[n] = this.inNg[i][13];
          obj13[o] = this.inNg[i][14];
          obj13[p] = this.inNg[i][15];
          obj13[q] = this.inNg[i][16];
          this.NGlist.push(obj13);
        }
      } else if (this.inNg[0].length == 18) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj14 = {};
          obj14[a] = this.inNg[i][0];
          obj14[b] = this.inNg[i][1];
          obj14[c] = this.inNg[i][2];
          obj14[d] = this.inNg[i][3];
          obj14[e] = this.inNg[i][4];
          obj14[f] = this.inNg[i][5];
          obj14[g] = this.inNg[i][6];
          obj14[h] = this.inNg[i][7];
          obj14[io] = this.inNg[i][8];
          obj14[j] = this.inNg[i][9];
          obj14[k] = this.inNg[i][10];
          obj14[L] = this.inNg[i][11];
          obj14[m] = this.inNg[i][12];
          obj14[n] = this.inNg[i][13];
          obj14[o] = this.inNg[i][14];
          obj14[p] = this.inNg[i][15];
          obj14[q] = this.inNg[i][16];
          obj14[r] = this.inNg[i][17];
          this.NGlist.push(obj14);
          // console.log("===============", this.oklist);
        }
      } else if (this.inNg[0].length == 19) {
        for (let i = 0; i < this.inNg.length; i++) {
          var obj15 = {};
          obj15[a] = this.inNg[i][0];
          obj15[b] = this.inNg[i][1];
          obj15[c] = this.inNg[i][2];
          obj15[d] = this.inNg[i][3];
          obj15[e] = this.inNg[i][4];
          obj15[f] = this.inNg[i][5];
          obj15[g] = this.inNg[i][6];
          obj15[h] = this.inNg[i][7];
          obj15[io] = this.inNg[i][8];
          obj15[j] = this.inNg[i][9];
          obj15[k] = this.inNg[i][10];
          obj15[L] = this.inNg[i][11];
          obj15[m] = this.inNg[i][12];
          obj15[n] = this.inNg[i][13];
          obj15[o] = this.inNg[i][14];
          obj15[p] = this.inNg[i][15];
          obj15[q] = this.inNg[i][16];
          obj15[r] = this.inNg[i][17];
          obj15[s] = this.inNg[i][18];
          this.NGlist.push(obj15);
        }
      }
    },

    cancelget() {
      // console.log("-----------------------终止请求");
      this.Popup_show = false;
      this.cancel();
      clearInterval(this.Popup_timer);
    },

 
    // loadAll() {
    //   return [{ value: "", address: "" }];
    // },
    querySearch(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString
        ? restaurants.filter(this.createFilter(queryString))
        : restaurants;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    createFilter(queryString) {
      return (restaurant) => {
        return (
          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
          0
        );
      };
    },
    handleSelect(item) {
      console.log(item);
    },
    handleIconClick(ev) {
      console.log(ev);
    },

    // 第一个柱状图
    myhistogram() {
      let my_second = this.$echarts.init(document.getElementById("my_second"));
      var keyname = [];
      var list = [];
      var titlename = [];
      let countlist = [];

      for (let i = 0; i < this.barcount.length; i++) {
        countlist = this.barcount[i].val;
        keyname.push(this.barcount[i].key);
      }

      for (let i = 0; i < countlist.length; i++) {
        titlename.push(countlist[i].key);
      }

      this.barcount.forEach((ele) => {
        list.push({
          name: ele.key,
          data: ele.val.map((item) => {
            return item;
          }),
          type: "bar",
          stack: "a",
          barWidth: 0,
          label: {
            show: false,
          },
        });
      });

     var option = {
        title:[ 
              {
              text: "缺陷个数量统计",
              left: "center",
              fontWeightL: 300,
              textStyle: {
                lineHeight: 6,
                fontSize: 14,
                manginLeft: 30,
              },
            },
            {
                subtext:"纵轴单位(个数)",
                subtextStyle:{
                align:"left",
                lineHeight: 66,
                fontSize:10,
                  padding: 15,
               }
            }
        ],
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // 坐标轴指示器，坐标轴触发有效
            type: "shadow", // 默认为直线，可选为：'line' | 'shadow'
          },
          position: function (point, params, dom, rect, size) {
            // 鼠标坐标和提示框位置的参考坐标系是：以外层div的左上角那一点为原点，x轴向右，y轴向下
            // 提示框位置
            var x = 0; // x坐标位置
            var y = 0; // y坐标位置

            // 当前鼠标位置
            var pointX = point[0];
            var pointY = point[1];

            // 外层div大小
            // var viewWidth = size.viewSize[0];
            // var viewHeight = size.viewSize[1];

            // 提示框大小
            var boxWidth = size.contentSize[0];
            var boxHeight = size.contentSize[1];

            // boxWidth > pointX 说明鼠标左边放不下提示框
            if (boxWidth > pointX) {
              x = 5;
            } else {
              // 左边放的下
              x = pointX - boxWidth;
            }

            // boxHeight > pointY 说明鼠标上边放不下提示框
            if (boxHeight > pointY) {
              y = 5;
            } else {
              // 上边放得下
              y = pointY - boxHeight;
            }

            return [x, y];
          },
        },
        legend: {
          type: "scroll",
          x: "center",
          y: "5%",
          data: keyname,
        },
        grid: {
          left: "2%",
          right: "3%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          // data: this.xAis,
          data:["","","","","","","","","","","","","","","","",""],
          axisLabel: {
            interval: 0,
            rotate: 30,
          },
          textStyle: {
            fontSize: 10,
          },
        },
        yAxis: {
          type: "value",
        },
        series: list,
      };
       window.onresize = function(){
          my_second.resize()
        }
        my_second.setOption(option,true);
        var selected = {};
        var isShow;
          for (var i = 0; i < option.series.length; i++) {
          selected[option.series[i].name] = true;
          isShow = false;
          if (i == option.series.length - 1) {
            isShow = true;
          }
          option.series[i].label = {
            normal: {
              show: isShow,
              position: "top",
              textStyle: {
                fontSize: "8px",
              },
            },
          };
        }
         var fun = function (obj) {
            var total = 0;
            for (var key in selected) {
              if (selected[key]) {
                for (var i = 0; i < option.series.length; i++) {
                  if (key == option.series[i].name) {
                    total += option.series[i].data[obj.dataIndex];
                  }
                }
              }
            }
            return total;
          };
          option.series[option.series.length - 1].label.normal.formatter = fun;
          my_second.setOption(option);
          my_second.on("legendselectchanged", function (obj) {
            selected = obj.selected;
            var flag = true;
            for (var i = option.series.length - 1; i >= 0; i--) {
              //只展示最后一个没有隐藏的列的label
              if (flag && selected[option.series[i].name]) {
                flag = false;
                option.series[i].label.normal.show = true;
                option.series[i].label.normal.formatter = fun;
              } else {
                option.series[i].label.normal.show = false;
                option.series[i].label.normal.formatter = function () {
                  return "";
                };
              }
            }
            //重新设置option
            my_second.setOption(option);
          });
    },

    // //  第二个柱状图   
      getlist() {
      var list = [];
      var keyname = [];
      var datalist = [];
      var titlename = [];
      // console.log("------------------", this.barYieid);

      for (let i = 0; i < this.barYieid.length; i++) {
        keyname.push(this.barYieid[i].key);
        datalist = this.barYieid[i].val;
      }

      for (let i = 0; i < datalist.length; i++) {
        titlename.push(datalist[i].key);
        //  keyname.push(datalist[i].key);
      }

      this.barYieid.forEach((ele) => {
        list.push({
          name: ele.key,
          data: ele.val.map((item) => {
            return item.toFixed(2);
          }),
          type: "bar",
          stack: "a",
          barWidth: 0,
          // barCateGoryGap: "30%",
          label: {
            show: false, //是否显示
            formatter: "{a}{b}:{c}%",
          },
        });
      });

      console.log(list)

      var myChart = this.$echarts.init(document.getElementById("myChart"));
      var option = {
        option: true,
        title: [
              {
                text: "百分缺陷统计",
                left: "center",
                fontWeightL: 300,
                textStyle: {
                  lineHeight: 6,
                  fontSize: 14,
                  manginLeft: 30,
                },
              },
              {
                subtext:"纵轴单位(百分比)",
                subtextStyle:{
                align:"left",
                lineHeight: 66,
                fontSize:10,
                  padding: 15,
               }
            }
        ],
        tooltip: {
          trigger: "axis",
          formatter: function (data) {
            var result = "";
            for (var i = 0; i < data.length; i++) {
              if (data[i].name == "value") {
                result += data[i].seriesName + ":" + data[i].value + "%" + "<br>";
              } else {
                result += data[i].seriesName + ":" + data[i].value + "%"+"<br>";
              }
            }
            return result;
          },
          axisPointer: {
            // 坐标轴指示器，坐标轴触发有效
            type: "shadow", // 默认为直线，可选为：'line' | 'shadow'
          },
          position: function (point, params, dom, rect, size) {
            // 鼠标坐标和提示框位置的参考坐标系是：以外层div的左上角那一点为原点，x轴向右，y轴向下
            // 提示框位置
            var x = 0; // x坐标位置
            var y = 0; // y坐标位置

            // 当前鼠标位置
            var pointX = point[0];
            var pointY = point[1];

            // 外层div大小
            // var viewWidth = size.viewSize[0];
            // var viewHeight = size.viewSize[1];

            // 提示框大小
            var boxWidth = size.contentSize[0];
            var boxHeight = size.contentSize[1];

            // boxWidth > pointX 说明鼠标左边放不下提示框
            if (boxWidth > pointX) {
              x = 5;
            } else {
              // 左边放的下
              x = pointX - boxWidth;
            }

            // boxHeight > pointY 说明鼠标上边放不下提示框
            if (boxHeight > pointY) {
              y = 5;
            } else {
              // 上边放得下
              y = pointY - boxHeight;
            }

            return [x, y];
          },
        },
        legend: {
          type: "scroll",
          x: "center",
          y: "5%",
          data: keyname,
        },
        grid: {
          left: "3%",
          right: "3%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          // data: this.xAis,
           data:["","","","","","","","","","","","","","","","",""],
          axisLabel: {
            interval: 0,
            rotate: 30,
          },
          textStyle: {
            fontSize: 10,
          },
          left: 10,
        },
        yAxis: {
          type: "value",
          inverse: false,
          // max:10,
          // nameGap:25,
        },
        series: list,
      } 
         window.onresize = function(){
           myChart.resize()
        }
          myChart.setOption(option ,true);
       var selected = {};
       var isShow;
      for (var i = 0; i < option.series.length; i++) {
        selected[option.series[i].name] = true;
        isShow = false;
        if (i == option.series.length - 1) {
          isShow = true;
        }
        option.series[i].label = {
          normal: {
            show: isShow,
            position: "top",
            textStyle: {
              fontSize: "8px",
            },
          },
        };
      }
      var fun = function (obj) {
        var total = 0;
        // var a = 0;
        for (var key in selected) {
          if (selected[key]) {
            for (var i = 0; i < option.series.length; i++) {
              if (key == option.series[i].name) {
                 total += Number(option.series[i].data[obj.dataIndex]);
              }
            }
          }
        }
                //  console.log(parseFloat(total.toFixed(1)))
        return parseFloat(total.toFixed(2))+'%';
      };
      option.series[option.series.length - 1].label.normal.formatter = fun;
      myChart.setOption(option);
      myChart.on("legendselectchanged", function (obj) {
        selected = obj.selected;
        var flag = true;
        for (var i = option.series.length - 1; i >= 0; i--) {
          //只展示最后一个没有隐藏的列的label
          if (flag && selected[option.series[i].name]) {
            flag = false;
            option.series[i].label.normal.show = true;
            option.series[i].label.normal.formatter = fun;
          } else {
            option.series[i].label.normal.show = false;
            option.series[i].label.normal.formatter = function () {
              return "";
            };
          }
        }
        //重新设置option
        myChart.setOption(option);
      });
    },
    // // 第三个柱状图
    theerbra() {
      var keyname = [];
      var list = [];
      var datalist = [];
      var titlename = [];

      for (let i = 0; i < this.barinNg.length; i++) {
        keyname.push(this.barinNg[i].key);
        datalist = this.barinNg[i].val;
      }

      for (let i = 0; i < datalist.length; i++) {
        titlename.push(datalist[i].key);
      }
      this.barinNg.forEach((ele) => {
        list.push({
          name: ele.key,
          data: ele.val.map((item) => {
            return item.toFixed(3);
          }),
          type: "bar",
          stack: "a",
          barWidth: 0,
          // barCateGoryGap: "30%",
          label: {
            show: false, //是否显示
            // position: "insideRight",
            // //  position: "top",
            // normal: {
            formatter: "{a}{b}:{c}%",
            // },
          },
        });
      });

      let mythreebar = this.$echarts.init(
        document.getElementById("mythreebar")
      );
      var option = {
        title: [
              {
              text: "百分缺陷统计",
              left: "center",
              fontWeightL: 300,
              textStyle: {
                lineHeight: 6,
                fontSize: 14,
                manginLeft: 30,
              },
            },
            {
                subtext:"纵轴单位(百分比)",
                subtextStyle:{
                align:"left",
                lineHeight: 66,
                fontSize:10,
                  padding: 15,
               }
            }
        ],
        tooltip: {
          trigger: "axis",
           formatter: function (data) {
            // console.log(data)
            var result = "";
            for (var i = 0; i < data.length; i++) {
              if (data[i].name == "value") {
                result += data[i].seriesName + ":" + data[i].value + "%" + "<br>";
              } else {
                result += data[i].seriesName + ":" + data[i].value + "%"+"<br>";
              }
            }
            return result;
          },
          axisPointer: {
            // 坐标轴指示器，坐标轴触发有效
            type: "shadow", // 默认为直线，可选为：'line' | 'shadow'
          },
          position: function (point, params, dom, rect, size) {
            // 鼠标坐标和提示框位置的参考坐标系是：以外层div的左上角那一点为原点，x轴向右，y轴向下
            // 提示框位置
            var x = 0; // x坐标位置
            var y = 0; // y坐标位置

            // 当前鼠标位置
            var pointX = point[0];
            var pointY = point[1];

            // 外层div大小
            // var viewWidth = size.viewSize[0];
            // var viewHeight = size.viewSize[1];

            // 提示框大小
            var boxWidth = size.contentSize[0];
            var boxHeight = size.contentSize[1];

            // boxWidth > pointX 说明鼠标左边放不下提示框
            if (boxWidth > pointX) {
              x = 5;
            } else {
              // 左边放的下
              x = pointX - boxWidth;
            }

            // boxHeight > pointY 说明鼠标上边放不下提示框
            if (boxHeight > pointY) {
              y = 5;
            } else {
              // 上边放得下
              y = pointY - boxHeight;
            }

            return [x, y];
          },
        },
        legend: {
          type: "scroll",
           x: "center",
          y: "5%",
          data: keyname,
        },
        grid: {
          left: "3%",
          right: "3%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          // data: this.xAis,
          data:["","","","","","","","","","","","","","","","",""],
          axisLabel: {
            interval: 0,
            rotate: 30,
          },
          textStyle: {
            fontSize: 10,
          },
        },
        yAxis: {
          type: "value",
        },
        series: list,
      } 
        mythreebar.setOption(option);
        var selected = {};
       var isShow;
      for (var i = 0; i < option.series.length; i++) {
        selected[option.series[i].name] = true;
        isShow = false;
        if (i == option.series.length - 1) {
          isShow = true;
        }
        option.series[i].label = {
          normal: {
            show: isShow,
            position: "top",
            textStyle: {
              fontSize: "8px",
            },
          },
        };
      }
      var fun = function (obj) {
        var temp = [];
        var total = 0;
        // var a = 0;
        for (var key in selected) {
          if (selected[key]) {
            for (var i = 0; i < option.series.length; i++) {
              if (key == option.series[i].name) {
                total += Number(option.series[i].data[obj.dataIndex]);
              }
            }
          }
        }
        temp.push(total);
         for(var j=0; j<temp.length;j++){
              if(temp[j]>100){
               total = temp[j] = 100;
               }
          }
        return parseFloat(total.toFixed(2))+'%';
      };
      option.series[option.series.length - 1].label.normal.formatter = fun;
      mythreebar.setOption(option);
      mythreebar.on("legendselectchanged", function (obj) {
        selected = obj.selected;
        var flag = true;
        for (var i = option.series.length - 1; i >= 0; i--) {
          //只展示最后一个没有隐藏的列的label
          if (flag && selected[option.series[i].name]) {
            flag = false;
            option.series[i].label.normal.show = true;
            option.series[i].label.normal.formatter = fun;
          } else {
            option.series[i].label.normal.show = false;
            option.series[i].label.normal.formatter = function () {
              return "";
            };
          }
        }
        //重新设置option
        mythreebar.setOption(option);
      });
    },

    //  tabls选项卡

    handleClick(tab, event) {
      console.log(tab, event);
    },
  },
};
</script>
<style  scoped>
.table_content {
  width: 100%;
  position: relative;
  background: gainsboro;

  /* margin-top:5px; */
}
.table_chart {
  width: 100%;
  /* display: flex;
  justify-content: space-between; */
  margin-top: 30px;
  background: #ffffff;
  border-radius: 5px 5px 5px 5px;
  box-shadow: 0px 0px 0px 1.5px #c9c8c8;
}
.table_to {
  width: 100%;
  background: #ffffff;
  margin-top: 10px;
}
.table_lsit {
  margin-top: 10px;
}

.table_serch {
  width: 100%;
  /* min-width: 900px; */
  padding-top: 8px;
  /* border: 1px solid red; */
  background: #ffffff;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  border-radius: 5px 5px 5px 5px;
  box-shadow: 0px 0px 0px 1.5px #c9c8c8;
  /* position: relative; */
}
.table_serch_labe {
  /* border: 1px solid #000; */
  height: 35px;
  /* width:200px; */
  display: flex;
  margin-right: 10px;
  margin-bottom: 10px;
}
.table_serch_labe_title {
  font-size: 11px;
  line-height: 40px;
}
.el-button_eb {
  margin-left: 5px;
  color: #fff;
}

.my_table {
  width: 100%;
  margin: 10px auto;
  margin-left:10px;
}

/* #tabsbox {
  /* margin-left: 10px; */
/* } */ 
.first_table {
  width: 100%;
}
.first_table_item {
  width: 100%;
  display: flex;
  align-items: center;
  overflow: auto;
  margin-top: 20px;
}
.second_table {
  width: 100%;
}

.second_table_item {
  width: 100%;
  display: flex;
  align-items: center;
  overflow: auto;
  margin-top: 20px;
}
.third_table {
  width: 100%;
}
.third_table_item {
  width: 100%;
  display: flex;
  align-items: center;
  overflow: auto;
  margin-top: 20px;
}
#myChart {
  width:1300px;
  height: 50vh;
  margin: 0 auto;
}
#my_second {
  width:1300px;
  height:50vh;
  margin: 0 auto;
}
#mythreebar {
  width:1300px;
  height:50vh;
  margin: 0 auto;
}

.tableyon > th {
  padding: 0 !important;
  height: 20px;
  line-height: 20px;
}

.table_loding {
  width: 200px;
  height: 100px;
  border: 1px solid rgb(68, 186, 236);
  position: absolute;
  z-index: 999;
  top: 30%;
  left: 40%;
  border-radius: 5px 5px 5px 5px;
  box-shadow: 0px 0px 0px 1px;
}

.table_title {
  color: rgb(101, 91, 91);
  font-size: 20px;
  text-align: center;
  line-height: 60px;
}
.table_timer {
  color: rgb(101, 91, 91);
  font-size: 20px;
  text-align: center;
  line-height: 10px;
}

 .el_table_cloum
 {
   min-width:9px
 }



@media screen and (min-width: 1920px) {
  #myChart {
    width: 1683px;
    height: 460px;
    margin: 0 auto;
  }
  #my_second {
    width: 1683px;
    height: 460px;
    margin: 0 auto;
  }
  #mythreebar {
    width: 1683px;
    height: 460px;
    margin: 0 auto;
  }
  .table_chart {
    margin-top: 60px;
  }

      #el-table-list
    {
      margin-left:-15px;
    }

}
</style>